#include <iostream>
#include <string>
#include <stdlib.h>
#include <cstdio>
#include "Enemy.h"
#include "Goomba.h"
using namespace std;

//Default constructor that sets the stats of the Goomba enemy to the predetermined values
Goomba::Goomba(void)
{
	healthPoints = 20;
	baseAttack = 20;
	baseDefense = 10;
	currentAttack = 0;
	enemyName = "Goomba";
}

//Constructor that sets stats to values passed in
Goomba::Goomba(int health, int atk, int def)
{
	healthPoints = health;
	baseAttack = atk;
	baseDefense = def;
	currentAttack = 0;
	enemyName = "Goomba";
}

//Destructor
Goomba::~Goomba(void)
{
}

//Function that returns a damage value that will be used to damage the hero
int Goomba::attackHero (void)
{
	cout << "The Goomba jumps on your head! ";//Specific message for the Goomba
	calcCurrentAttack();
	return currentAttack;
}

//Function to determine how much damage the Goomba will take
void Goomba::takeDamage (int damage)
{
	int actualDamage = damage - baseDefense;
	//Determines the damage done and then takes it out of the healthPoints variable
	if (actualDamage < 0)
	{
		cout << "The Goomba avoids the hit!" << endl;
	}
	else
	{
		cout << "The Goomba takes " << actualDamage << " damage!" << endl;
		healthPoints = healthPoints - actualDamage;
	}
}

//Tries to make the hero fall asleep (giving him no actions for a few turns)
void Goomba::sleepHero(Hero &hero)
{
	cout << "The Goomba attempts to put you to sleep! ";
	int value = rand() % 4;
	if (value == 2)
		hero.setSleepStatus(true);
}
